package com.kerbores.jfinal.controller.base;

import java.util.LinkedHashMap;

import com.jfinal.core.Controller;
import com.jfinal.render.JsonRender;
import com.kerbores.utils.entries.Result;

/**
 * @author 王贵源
 *
 *         create at 2014年9月22日 下午9:45:46
 */
public class BaseController extends Controller {

	/**
	 * @return the data
	 */
	public LinkedHashMap<String, Object> getData() {
		return data;
	}

	/**
	 * @param data the data to set
	 */
	public void setData(LinkedHashMap<String, Object> data) {
		this.data = data;
	}

	/**
	 * @return the result
	 */
	public Result getResult() {
		return result;
	}

	/**
	 * @param result the result to set
	 */
	public void setResult(Result result) {
		this.result = result;
	}

	protected LinkedHashMap<String, Object> data = new LinkedHashMap<String, Object>();

	protected Result result = Result.me();

	protected void jsonRender(Object obj) {
		render(new JsonRender(obj).forIE());
	}

	protected void jspRender(String jsp) {
		setAttr("result", result);
		render(jsp);
	}

}
